package com.ujs.eduservice.controller.front;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ujs.commonutils.constant.R;
import com.ujs.eduservice.entity.EduCourse;
import com.ujs.eduservice.entity.EduTeacher;
import com.ujs.eduservice.service.EduCourseService;
import com.ujs.eduservice.service.EduTeacherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author zhangshihao
 * @create 2023-08-10 17:03
 */
@RestController
@RequestMapping("/eduservice/indexfront")
@Api(tags = "名师和课程前台显示")
public class IndexFrontController {
    @Autowired
    private EduCourseService courseService;
    @Autowired
    private EduTeacherService teacherService;


    @GetMapping("/index")
    @ApiOperation("查询前8名课程和4名讲师")
    public R index() {
        List<EduCourse> courseList = courseService.getHotCourse();
        List<EduTeacher> teacherList = teacherService.getHotTeacher();
        return R.ok().data("teacher", teacherList).data("course", courseList);
    }
}
